<?php
/**
 * 企业资料model
 * User: guojing
 * Date: 2020/4/5
 * Time: 21:54
 */
namespace app\api\model;

use think\Model;

class Company extends Model
{

    protected $name = 'company';

    public static function findInfoByCondition($condition = [])
    {
        return self::where($condition)->find();
    }

    public static function saveData($id, $data)
    {
        if ($id && $data) {
            $data['updatetime'] = time();
            self::where(['id' => $id])->update($data);
        }
    }

    public static function addRecord($addData = [])
    {
        $addData['createtime'] = time();
        $addData['updatetime'] = time();
        return self::create($addData);
    }

    /**
     * 增加项目总数
     */
    public static function incProjectNums($condition = [], $nums = 1)
    {
        return self::where($condition)->setInc('project_nums', $nums);
    }

}